<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>运单录入</title>
		<!-- 导入jquery核心类库 -->
		<script type="text/javascript" src="../../js/jquery-1.8.3.js"></script>
		<!-- 导入easyui类库 -->
		<link rel="stylesheet" type="text/css" href="../../js/easyui/themes/default/easyui.css">
		<link rel="stylesheet" type="text/css" href="../../js/easyui/themes/icon.css">
		<link rel="stylesheet" type="text/css" href="../../js/easyui/ext/portal.css">
		<link rel="stylesheet" type="text/css" href="../../css/default.css">
		<script type="text/javascript" src="../../js/easyui/jquery.easyui.min.js"></script>
		<script type="text/javascript" src="../../js/easyui/ext/jquery.portal.js"></script>
		<script src="../../js/easyui/locale/easyui-lang-zh_CN.js" type="text/javascript"></script>
		</script>
		<script type="text/javascript">
			$(function() {
				// 先将body隐藏，再显示，不会出现页面刷新效果
				$("body").css({visibility:"visible"});

				
				// 对save按钮条件 点击事件
				$('#save').click(function() {
					$.post("../../waybill_save.action",$("#waybillForm").serialize(),function(data){
					    if(data=="success"){
					        alert("保存成功");
						}else{
					        alert("保存失败");
						}
					},"json");
				});
				
				// 对订单号输入项 添加 blur事件
				$("#orderNum").blur(function(){
					
				});
				
				// 对运单快速录入数据进行回显
				$("#wayBillNum").blur(function(){
					$.post('../../wayBill_findOneByWayBillNum.action',{wayBillNum:$(this).val()},function(data){
					   if(data.success=="success"){
                           $("#waybillForm").form("load",data.wayBill);
					   }else{
					       $("#waybillForm").form("reset");
					   }

					},"json");
				});

				
			});
        $.fn.serializeJson = function(){
            var serializeObj={};
            var array=this.serializeArray();
            var str=this.serialize();
            $(array).each(function(){
                if(serializeObj[this.name]){
                    if($.isArray(serializeObj[this.name])){
                        serializeObj[this.name].push(this.value);
                    }else{
                        serializeObj[this.name]=[serializeObj[this.name],this.value];
                    }
                }else{
                    serializeObj[this.name]=this.value;
                }
            });
            return serializeObj;
        };
		</script>
	</head>

	<body>
		<div class="datagrid-toolbar">
			<a id="add" icon="icon-add" href="#" class="easyui-linkbutton" plain="true">新增</a>
			<a id="save" icon="icon-save" href="#" class="easyui-linkbutton" plain="true">保存</a>
			<a id="no" icon="icon-no" href="#" class="easyui-linkbutton" plain="true">取消</a>
		</div>
		
		<div style="width:95%;margin:10px auto">
			<form id="waybillForm" method="post" action="../../waybill_save.action" >
				<!-- 单号信息 -->
				<div class="table-top">
					<table class="table-edit" width="95%">
						<tr class="title">
							<td colspan="6">单号信息</td>
						</tr>
						<tr>
							<input type="hidden" name="id"></input>
							<td>运单号</td>
							<td>
								<input type="text" name="wayBillNum" id="wayBillNum"/>
							</td>
							<td>配载要求</td>
							<td>
								<select class="easyui-combobox" name="floadreqr">
									<option value="无">无</option>
									<option value="禁航空">禁航空</option>
									<option value="禁铁路航空">禁铁路航空</option>
								</select>
							</td>
						</tr>
						<tr>
							<td>到达地</td>
							<td><input type="text" name="arriveCity" required="true" /></td>
							<td>产品时限</td>
							<td>
								<select class="easyui-combobox" name="sendProNum">
									<option value="速运当日">速运当日</option>
									<option value="速运次日">速运次日</option>
									<option value="速运隔日">速运隔日</option>
								</select>
							</td>
						</tr>
						<tr>
							<td>受理单位</td>
							<td><input type="text" name="order.courier.company" required="true" /></td>
							<td>快递员</td>
							<td><input type="text" name="order.courier.name" required="true" /></td>
						</tr>
					</table>
				</div>
				
				<div class="table-center" style="margin-top:15px">
					<!-- 中间三大行：货物信息、收件人信息、寄件人信息 -->
					<div class="col-md-5">
						<!-- 寄件人信息 -->
						<table class="table-edit send" width="95%">
							<tr class="title">
								<td colspan="4">寄件人信息</td>
							</tr>
							<tr>
								<td>寄件人</td>
								<td><input type="text" name="sendName" required="true" /></td>
								<td>地址</td>
								<td><input type="text" id="sendAddress" name="sendAddress" required="true" size="80"/></td>
							</tr>
							<tr>
								<td>公司</td>
								<td><input type="text" name="sendCompany" required="true" /></td>
								<td>电话</td>
								<td><input type="text" name="sendMobile" required="true" /></td>
							</tr>
						</table>
						
							
						<!-- 收件人信息 -->
						<table class="table-edit receiver" width="95%">
							<tr class="title">
								<td colspan="4">收件人信息</td>
							</tr>
							<tr>
								<td>收件人</td>
								<td><input type="text" name="recName" required="true" /></td>
								<td>地址</td>
								<td><input type="text" id="recAddress" name="recAddress" required="true" size="80"/></td>
							</tr>
							<tr>
								<td>公司</td>
								<td><input type="text" name="recCompany" required="true" /></td>
								<td>电话</td>
								<td><input type="text" name="recMobile" required="true" /></td>
							</tr>
						</table>
						
						<!-- 货物信息 -->
						<table class="table-edit number" width="95%">
							<tr class="title">
								<td colspan="4">货物信息</td>
							</tr>
							<tr>
								<td>原件数</td>
								<td><input type="text" name="num" required="true" /></td>
								<td>实际重量</td>
								<td><input type="text" name="actlweit" required="true" /></td>
							</tr>
	
							<tr>
								<td>货物</td>
								<td><input type="text" name="goodsType" required="true" /></td>
								<td>体积</td>
								<td><input type="text" name="vol" required="true" /></td>
							</tr>
						</table>
					</div>
					

				</div>
				<div class="clearfix"></div>
			</form>
		</div>
	</body>
</html>